package design.createModel.factory.simpleFactory.demo2;

public class SimpleCoffeeFactory {

    public Coffee createCoffee(String type){
        //根据name的值生成不同的coffee子类
        Coffee coffee = null;
        if ("a".equals(type)){
            coffee = new AmericanCoffee();
        }else if ("l".equals(type)){
            coffee = new LatteCoffee();
        }else {
            throw new RuntimeException("sorry name is not exist");
        }

        return coffee;
    }
}
